#ifndef CHATROOM_H
#define CHATROOM_H

#include <QDebug>
#include <QObject>
#include <QWidget>
#include <QTextEdit>
#include <QPushButton>
#include <QTcpSocket>
#include <QStackedWidget>
#include <QNetworkAccessManager>

class ChatRoom : public QWidget {
    Q_OBJECT
public:
    ChatRoom(QStackedWidget* stackedWidget, QWidget *parent = nullptr);

    void sendMessage();
    void updateMessage();
    void initUI();

private slots:
    void onReadyRead();

private:
    QTcpSocket *socket;
    QStackedWidget *stackedWidget;

    QTextEdit* textEdit;
    QTextEdit* messageShow;
    QPushButton* sendButton;
};

#endif // CHATROOM_H
